<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

	<%@ include file="/WEB-INF/jsp/common/css.jsp" %>
	<style>
	.tree li {
        list-style-type: none;
		cursor:pointer;
	}
	table tbody tr:nth-child(odd){background:#F4F4F4;}
	table tbody td:nth-child(even){color:#C00;}
	</style>
  </head>

  <body>

    <jsp:include page="/WEB-INF/jsp/common/top.jsp"></jsp:include>

    <div class="container-fluid">
      <div class="row">
        <jsp:include page="/WEB-INF/jsp/common/sidebar.jsp"></jsp:include>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
			<div class="panel panel-default">
			  <div class="panel-heading">
				<h3 class="panel-title"><i class="glyphicon glyphicon-th"></i> 数据列表</h3>
			  </div>
			  <div class="panel-body">
<form id="queryForm" class="form-inline" role="form" style="float:left;" action="${PATH }/auth_project/index">
  <div class="form-group has-feedback">
    <div class="input-group">
      <div class="input-group-addon">查询条件</div>
      <input name="condition" class="form-control has-success" type="text" value="${param.condition }" placeholder="请输入查询条件">
    </div>
  </div>
  <button type="button" class="btn btn-warning" onclick="$('#queryForm').submit()"><i class="glyphicon glyphicon-search"></i> 查询</button>
</form>
<br>
 <hr style="clear:both;">
          <div class="table-responsive">
            <table class="table  table-bordered">
              <thead>
                <tr >
                  <th width="30">#</th>
                  <th>项目名称</th>
                  <th>目标金额（元）</th>
                  <th>众筹周期(天)</th>
                  <th>创建时间</th>
                  <th width="100">操作</th>
                </tr>
              </thead>
              <tbody>
                <c:forEach items="${page.list }" var="project" varStatus="status">
                <tr>
                  <td>
	                  ${status.count }
	                  <input type="hidden" value="${project.id}">
                  </td>
                  <td>${project.name}</td>
                  <td>${project.money}</td>
                  <td>${project.day}</td>
                  <td>${project.createdate}</td>
                  <td>
                      <button type="button" class="btn btn-success btn-xs" onclick="authProject(${project.id})"><i class="glyphicon glyphicon-eye-open"></i></button>
				  </td>
                </tr>
                </c:forEach>
              </tbody>
			  <tfoot>
			     <tr >
				     <td colspan="6" align="center">
						<ul class="pagination">
						<!-- 第一页 -->
							<c:if test="${page.isFirstPage }">
								<li class="disabled"><a href="#">上一页</a></li>
							</c:if>
							<!-- 非第一页 -->
							<c:if test="${!page.isFirstPage }">
								<li><a href="${PATH }/auth_project/index?condition=${param.condition }&pageNum=${page.prePage}">上一页</a></li>
							</c:if>
							
							<c:forEach items="${page.navigatepageNums }" var="navigatepageNum" >
								<c:if test="${navigatepageNum == page.pageNum}">
									<li class="active"><a href="#">${navigatepageNum} <span class="sr-only">(current)</span></a></li>
								</c:if>
								<c:if test="${navigatepageNum != page.pageNum}">
									<li><a href="${PATH }/auth_project/index?condition=${param.condition }&pageNum=${navigatepageNum}">${navigatepageNum }</a></li>
								</c:if>
							</c:forEach>
														
							<!-- 末页 -->
							<c:if test="${page.isLastPage }">
								<li class="disabled"><a href="#">下一页</a></li>
							</c:if>
							<!-- 非末页 -->
							<c:if test="${!page.isLastPage }">
								<li><a href="${PATH }/auth_project/index?condition=${param.condition }&pageNum=${page.nextPage}">下一页</a></li>
							</c:if>
						 </ul>
					 </td>
				 </tr>

			  </tfoot>
            </table>
          </div>
			  </div>
			</div>
        </div>
      </div>
    </div>

    <%@ include file="/WEB-INF/jsp/common/js.jsp" %>
      <script type="text/javascript">
        $(function () {  // ready事件，当前页面被浏览器加载完成时触发的事件。
		    $(".list-group-item").click(function(){
			    if ( $(this).find("ul") ) {
					$(this).toggleClass("tree-closed");
					if ( $(this).hasClass("tree-closed") ) {
						$("ul", this).hide("fast");
					} else {
						$("ul", this).show("fast");
					}
				}
			});
		});
		function authProject(projectId){
			layer.confirm('您确认审核该项目吗？', {
        	  btn: ['确认','取消'] //按钮
        	}, function(index){
            	window.location.href="${PATH}/auth_project/auth?condition=${param.condition }&pageNum=${page.pageNum}&id="+projectId;
            	layer.close(index);
        	}, function(index){
        		layer.close(index);
        	});
		}
      </script>
  </body>
</html>
